\name{plotBars}
\alias{plotBars}
\title{
  Barplots of Annual Age Proportions
}
\description{
  Plot barplots of specific-year age proportions.
}
\usage{
plotBars(res, type="N", prop=TRUE, year=min(res[[type]][["Year"]]), 
    sex=c(2,1), age=NULL, fill=c("orange", "cyan", "green"), 
    eps=FALSE, pix=FALSE, win=TRUE, ...)
}
\arguments{
  \item{res}{Awatea results file from a call to \code{importRes}: \cr
    \code{importRes("POPrun05/pop-3CD.05.01.res",Dev=T,CPUE=T,Survey=T,CAc=T,CAs=T)}}
  \item{type}{type of annual value (e.g., \code{"N"} = numbers, \code{"B"} = biomass).}
  \item{prop}{logical: if \code{TRUE}, convert values from \code{type} to proportions.}
  \item{year}{numeric scalar or vector of years.}
  \item{sex}{sex code where \code{1} = males and \code{2} = females; note that Awatea uses females before males.}
  \item{age}{specify age vector if subset of available is desired.}
  \item{fill}{bar colour by sex for barplots (one colour per sex).}
  \item{eps}{logical: if \code{TRUE}, send figure to a postscript (\code{.eps}) file.}
  \item{pix}{logical: if \code{TRUE}, send figure to a portable network graphics (\code{.png}) file.}
  \item{win}{logical: if \code{TRUE}, send figure to the R windows device.}
  \item{\dots}{extra parameters (not currently used).}
}
\details{
  The plot is used primarily to see how an age composition for a year compares with an
  equilibrium age structure (represented by an exponential decay from 1 using \eqn{e^{-M}}{exp(-M)}).
}
\value{
  Aside from the figure  plots, the function invisibly returns a list of:
  \item{dat}{data file from \code{importRes} for the \code{type} and \code{year} specified.}
  \item{mat}{three-dimensional array (age, sex, year) for the year(s) specified.}
  \item{xpos}{x-position generated by barplot for the ages specified.}
}
\author{
  Rowan Haigh, Pacific Biological Station, Fisheries and Oceans Canada, Nanaimo BC
}
\seealso{
  \code{\link[PBSawatea]{plotBox}}, \code{\link[PBSawatea]{compB0}}
}
\keyword{hplot}

